// 客户端
#include "Comm.hpp"
#include "Fifo.hpp"
#include <unistd.h>
int main()
{
    // 创建Key值
    key_t key = GetShmKeyOrDie();
    cout << "key:" << ToHex(key) << endl;

    // 获取共享内存
    int shmid = Getshm(key, defaultsize);

    // 挂接共享内存
    char *addr = (char *)shmAttach(shmid);
    cout << "挂接成功,起始虚拟地址为:" << ToHex((uint64_t)addr) << endl;

    Sync s;
    s.OpenWrite();

    // 进程间通信
    memset(addr, 0, defaultsize);
    for (char c = 'A'; c <= 'Z'; c++)
    {
        addr[c - 'A'] = c;
        sleep(1);
        s.WaitUp();
    }

    // 去关联
    ShmDetach(addr);
    return 0;
}